
<!--_meta 作为公共模版分离出去-->
{include file="public/_meta"}

    <nav class="breadcrumb">
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:window.location.reload();" title="刷新">
            <i class="Hui-iconfont"></i>
        </a>
    </nav>
    <div class="page-container">
        <form action="" method="post" class="form form-horizontal" id="form-article-edit" enctype="multipart/form-data">
               <input type="hidden" value="{$users['id']}" name="id">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3" style="text-align: center"><span class="c-red">*</span>用户名：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        {if condition="$users['username'] eq null"}
                        暂无
                        {else/}
                        {$users['username']}
                        {/if}
                    </div>
                </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3" style="text-align: center"><span class="c-red">*</span>姓名：</label>
                <div class="formControls col-xs-8 col-sm-8">
                    {if condition="$users['full_name'] eq null"}
                        暂无
                    {else/}
                        {$users['full_name']}
                    {/if}
                </div>
            </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3" style="text-align: center"><span class="c-red">*</span>昵称：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        {if condition="$users['nickname'] eq null"}
                            暂无
                        {else/}
                            {$users['nickname']}
                        {/if}
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3" style="text-align: center"><span class="c-red">*</span>手机号：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        {if condition="$users['tel'] eq null"}
                            暂无
                        {else/}
                            {$users['tel']}
                        {/if}
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3" style="text-align: center"><span class="c-red">*</span>性别：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        {if condition="$users['sex'] eq 0"}
                            男
                        {else/}
                            女
                        {/if}
                    </div>
                </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3" style="text-align: center"><span class="c-red">*</span>用户组：</label>
                <div class="formControls col-xs-8 col-sm-8">
                    {if condition="$users['title'] eq null"}
                        暂无
                    {else/}
                        {$users['title']}
                    {/if}
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3" style="text-align: center"><span class="c-red">*</span>年龄：</label>
                <div class="formControls col-xs-8 col-sm-8">
                    {if condition="$users['age'] eq null"}
                        暂无
                    {else/}
                        {$users['age']}
                    {/if}
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3" style="text-align: center"><span class="c-red">*</span>地址：</label>
                <div class="formControls col-xs-7 col-sm-8" style="padding: 0;">
                    <div class="col-xs-4 col-sm-4 col-lg-4">
                        <select name="provincecode" class="province select-box" id="province">
                            <option value="">选择省</option>
                            {volist name="province" id="val"}
                                {if condition="$users.provincecode eq $val.code"}
                                     <option value="{$val.code}" selected="selected">{$val.name}</option>
                                {else/}
                                    <option value="{$val.code}">{$val.name}</option>
                            {/if}
                            {/volist}
                        </select>
                    </div>
                    <div class="col-xs-4 col-sm-4 col-lg-4">
                        <select name="citycode" class="city select-box" id="city">
                            <option value="">选择市</option >
                            {volist name="city" id="val"}
                                {if condition="$users.citycode eq $val.code"}
                                    <option value="{$val.code}" selected="selected">{$val.name}</option>
                                {else/}
                                    <option value="{$val.code}">{$val.name}</option>
                                {/if}
                            {/volist}
                        </select>
                    </div>
                    <div class="col-xs-4 col-sm-4 col-lg-4">
                        <select name="areacode" class="area select-box" id="area">
                            <option value="">选择区</option>

                            {volist name="area" id="val"}
                                {if condition="$users.area_code eq $val.code"}
                                <option value="{$val.code}" selected="selected">{$val.name}</option>
                                {else/}
                                <option value="{$val.code}">{$val.name}</option>
                                {/if}
                            {/volist}
                        </select>
                    </div>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3" style="text-align: center"><span class="c-red">*</span>街道：</label>
                <div class="formControls col-xs-7 col-sm-8">
                    <input type="text" class="input-text" value="{$users['address']}" placeholder="街道门牌号" id="" name="address">
                </div>
            </div>
            <div class="row cl" >
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary size-M radius" type="submit" value="编辑">
                    <button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn btn-success size-M radius" type="button">取消</button>
                </div>
            </div>
        </form>
    </div>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer"}

    <script>
        //省市区联动
        $("#province").change(function(){
            city();
            function city(){
                $.ajax({
                    url:"{:url('admin/member/city')}",
                    data:{provincecode:$("#province").val()},
                    type:"post",
                    dataType:'json',
                    async:false,   //同步
                    success:function(city){
                        var str='<option>请选择</option>';
                        for(var i=0;i<city.length;i++){
                            str+="<option value = " + city[i].code +">"
                                    + city[i].name + "</option>";
                        }
                        $("#city").html(str);
                        $("#area").html("<option>请选择</option>");
                    }
                });
            }
        });
        $("#city").change(function(){
            area();
            function area(){
                $.ajax({
                    url:"{:url('admin/member/area')}",
                    data:{citycode:$("#city").val()},
                    type:"post",
                    dataType:'json',
                    async:false,   //同步
                    success:function(area){
                        var str='';
                        for(var i=0;i<area.length;i++){
                            str+="<option value = " + area[i].code +">"
                                    + area[i].name + "</option>";
                        }
                        $("#area").html(str);
                    }
                });
            }
        });
    </script>
<script>

    /*用户-编辑地址*/
    $("#form-article-edit").validate({

        onkeyword:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            var data = $(form).serializeArray();
            $(form).ajaxSubmit({
                type:"post",
                url:"{:url('address/edit_member_address')}",
                data:data,
                dataType:"json",
                success:function(rec){
                    if(rec.status  == true){
                        layer.msg(rec.message,{icon:6,time:1000});
                        setTimeout(jump,1000);
                        function jump(){
                            parent.location.reload();
                        }
                    }else if(rec.status == false){
                        layer.msg(rec.message,{icon:5,time:2000});
                    }
                }
            });
        }
    });
</script>
